class CQueue:
  def __init__(self):
    self.list_1 = []
    self.list_2 = []

  def appendTail(self, value: int) -> None:
    self.list_1.append(value)

  def deleteHead(self) -> int:
    if len(self.list_1) == 0 and len(self.list_2) == 0:
      return -1
    for i in range(len(self.list_1)):
      self.list_2.append(self.list_1.pop())
    value = self.list_2.pop()
    for i in range(len(self.list_2)):
      self.list_1.append(self.list_2.pop())
    return value


'''
STATUS: SOLVED
TRIES:  3
TIME:   2072 MS
MEMORY: 17.2 MB
'''
if __name__ == "__main__":
  c_queue = CQueue()
  print(c_queue.appendTail(1), end=' ')
  print(c_queue.appendTail(2), end=' ')
  print(c_queue.deleteHead(), end=' ')
  print(c_queue.appendTail(3), end=' ')
  print(c_queue.deleteHead(), end=' ')
  print(c_queue.appendTail(4), end=' ')
  print(c_queue.appendTail(5), end=' ')
  print(c_queue.deleteHead(), end=' ')
  print('\n----------')
  print('list_1', c_queue.list_1)
  print('list_2', c_queue.list_2)